package service

import (
	"project-im/config"
	"project-im/internal/model/dao"
)

// 判断是否有此人
func IsNull(userName, nickName string) (users dao.ImUser) {
	var user dao.ImUser
	config.DB.Where("user_name like ? or nick_name like ?", "%"+userName+"%", "%"+nickName+"%").Find(&user)
	return user
}

// 判断好友列表是否有该好友
func IsFriend(userName, nickName string) bool {
	var friend dao.ImFriend
	config.DB.Where("user_name like ? or nick_name like ?", "%"+userName+"%", "%"+nickName+"%").Find(&friend)
	if friend.ID == 0 {
		return false
	} else {
		return true
	}
}
